
/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package Apusic.impl;

import Apusic.ApusicPackage;
import Apusic.HttpSessionCfg;
import Apusic.HttpWebCfg;
import Apusic.LoggingCfg;
import Apusic.MuxerCfg;
import Apusic.SystemServiceManager;
import Apusic.TransactionCfg;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import javax.management.ObjectName;
import org.eclipse.emf.ecore.EObject;
import com.apusic.admin.config.*;
import com.apusic.admin.*;

import cn.edu.pku.sei.ra.wrapping.CommonWrapping.WrappingEObject;
import cn.edu.pku.sei.ra.wrapping.CommonWrapping.impl.WrappingEObjectImpl;
import cn.edu.pku.sei.ra.wrapping.CommonWrapping.util.EObjectContainmentEListForWrapping;
import cn.edu.pku.sei.ra.wrapping.CommonWrapping.util.EObjectResolvingEListForWrapping;
import cn.edu.pku.sei.ra.wrapping.CommonWrapping.util.ImagePool;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>System Service Manager</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link Apusic.impl.SystemServiceManagerImpl#getTransCfg <em>Trans Cfg</em>}</li>
 *   <li>{@link Apusic.impl.SystemServiceManagerImpl#getMuxerCfg <em>Muxer Cfg</em>}</li>
 *   <li>{@link Apusic.impl.SystemServiceManagerImpl#getLogCfg <em>Log Cfg</em>}</li>
 *   <li>{@link Apusic.impl.SystemServiceManagerImpl#getHttpSessionCfg <em>Http Session Cfg</em>}</li>
 *   <li>{@link Apusic.impl.SystemServiceManagerImpl#getHttpWebConfig <em>Http Web Config</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SystemServiceManagerImpl extends WrappingEObjectImpl implements SystemServiceManager
{
  /**
   * The cached value of the '{@link #getTransCfg() <em>Trans Cfg</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTransCfg()
   * @generated
   * @ordered
   */
  protected TransactionCfg transCfg;

  /**
   * The cached value of the '{@link #getMuxerCfg() <em>Muxer Cfg</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMuxerCfg()
   * @generated
   * @ordered
   */
  protected MuxerCfg muxerCfg;

  /**
   * The cached value of the '{@link #getLogCfg() <em>Log Cfg</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getLogCfg()
   * @generated
   * @ordered
   */
  protected LoggingCfg logCfg;

  /**
   * The cached value of the '{@link #getHttpSessionCfg() <em>Http Session Cfg</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getHttpSessionCfg()
   * @generated
   * @ordered
   */
  protected HttpSessionCfg httpSessionCfg;

  /**
   * The cached value of the '{@link #getHttpWebConfig() <em>Http Web Config</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getHttpWebConfig()
   * @generated
   * @ordered
   */
  protected HttpWebCfg httpWebConfig;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected SystemServiceManagerImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return ApusicPackage.Literals.SYSTEM_SERVICE_MANAGER;
  }

  
  

  
  
  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */ 
   public boolean isForCore(Object arg0){
   	boolean result=true;
   	if(core==null) return false;
    try{
    result=true;
    }
    catch(Exception e){
      result=false;
    }
    return result;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */ 
  public List listSubCores(int featureID){
    List result=new ArrayList();
  
    SystemServiceMgr core=(SystemServiceMgr)this.getCore();
    if(core==null) 
      return result;
    switch(featureID){
    
  
  
  
  
  
  }
    return result;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */ 
  public EClass getChildClassMap(Object object){
    ApusicPackage pack=ApusicPackage.eINSTANCE;	
  
    return null;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public TransactionCfg getTransCfg()
  {
    if (transCfg != null && transCfg.eIsProxy())
    {
      InternalEObject oldTransCfg = (InternalEObject)transCfg;
      transCfg = (TransactionCfg)eResolveProxy(oldTransCfg);
      if (transCfg != oldTransCfg)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, ApusicPackage.SYSTEM_SERVICE_MANAGER__TRANS_CFG, oldTransCfg, transCfg));
      }
    }
        Object result=null;
        SystemServiceMgr core=(SystemServiceMgr)getCore();
        if(core==null) return transCfg;	
        try
{
    result = core.fetchTransactionConfig();
    TransactionCfgImpl tci=new TransactionCfgImpl();
     tci.setCore(result);
     result=tci;
     
}
catch(Exception e)
{
  result = null;
}
        transCfg=(result instanceof EObject)?(TransactionCfg)result:(TransactionCfg)ImagePool.find(result);
        	
    return transCfg; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public TransactionCfg basicGetTransCfg()
  {
    return transCfg;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setTransCfg(TransactionCfg newTransCfg)
  {
    TransactionCfg oldTransCfg = transCfg;
    transCfg = newTransCfg;
        	
      SystemServiceMgr core=(SystemServiceMgr)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.SYSTEM_SERVICE_MANAGER__TRANS_CFG, oldTransCfg, transCfg));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public MuxerCfg getMuxerCfg()
  {
    if (muxerCfg != null && muxerCfg.eIsProxy())
    {
      InternalEObject oldMuxerCfg = (InternalEObject)muxerCfg;
      muxerCfg = (MuxerCfg)eResolveProxy(oldMuxerCfg);
      if (muxerCfg != oldMuxerCfg)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, ApusicPackage.SYSTEM_SERVICE_MANAGER__MUXER_CFG, oldMuxerCfg, muxerCfg));
      }
    }
        Object result=null;
        SystemServiceMgr core=(SystemServiceMgr)getCore();
        if(core==null) return muxerCfg;	
        try
{
    result = core.fetchMuxerConfig();
     MuxerCfgImpl mci=new MuxerCfgImpl();
     mci.setCore(result);
     result=mci;
     
}
catch(Exception e)
{
  result = null;
}
        muxerCfg=(result instanceof EObject)?(MuxerCfg)result:(MuxerCfg)ImagePool.find(result);
        	
    return muxerCfg; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public MuxerCfg basicGetMuxerCfg()
  {
    return muxerCfg;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setMuxerCfg(MuxerCfg newMuxerCfg)
  {
    MuxerCfg oldMuxerCfg = muxerCfg;
    muxerCfg = newMuxerCfg;
        	
      SystemServiceMgr core=(SystemServiceMgr)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.SYSTEM_SERVICE_MANAGER__MUXER_CFG, oldMuxerCfg, muxerCfg));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public LoggingCfg getLogCfg()
  {
    if (logCfg != null && logCfg.eIsProxy())
    {
      InternalEObject oldLogCfg = (InternalEObject)logCfg;
      logCfg = (LoggingCfg)eResolveProxy(oldLogCfg);
      if (logCfg != oldLogCfg)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, ApusicPackage.SYSTEM_SERVICE_MANAGER__LOG_CFG, oldLogCfg, logCfg));
      }
    }
        Object result=null;
        SystemServiceMgr core=(SystemServiceMgr)getCore();
        if(core==null) return logCfg;	
        try
{
    result = core.fetchLoggingConfig();
     LoggingCfgImpl lci=new LoggingCfgImpl();
     lci.setCore(result);
     result=lci;
     
}
catch(Exception e)
{
  result = null;
}
        logCfg=(result instanceof EObject)?(LoggingCfg)result:(LoggingCfg)ImagePool.find(result);
        	
    return logCfg; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public LoggingCfg basicGetLogCfg()
  {
    return logCfg;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setLogCfg(LoggingCfg newLogCfg)
  {
    LoggingCfg oldLogCfg = logCfg;
    logCfg = newLogCfg;
        	
      SystemServiceMgr core=(SystemServiceMgr)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.SYSTEM_SERVICE_MANAGER__LOG_CFG, oldLogCfg, logCfg));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public HttpSessionCfg getHttpSessionCfg()
  {
    if (httpSessionCfg != null && httpSessionCfg.eIsProxy())
    {
      InternalEObject oldHttpSessionCfg = (InternalEObject)httpSessionCfg;
      httpSessionCfg = (HttpSessionCfg)eResolveProxy(oldHttpSessionCfg);
      if (httpSessionCfg != oldHttpSessionCfg)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, ApusicPackage.SYSTEM_SERVICE_MANAGER__HTTP_SESSION_CFG, oldHttpSessionCfg, httpSessionCfg));
      }
    }
        Object result=null;
        SystemServiceMgr core=(SystemServiceMgr)getCore();
        if(core==null) return httpSessionCfg;	
        try
{
    result = core.fetchHttpSessionConfig();
   HttpSessionCfgImpl hci=new HttpSessionCfgImpl();
     hci.setCore(result);
     result=hci;
     
}
catch(Exception e)
{
  result = null;
}
        httpSessionCfg=(result instanceof EObject)?(HttpSessionCfg)result:(HttpSessionCfg)ImagePool.find(result);
        	
    return httpSessionCfg; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public HttpSessionCfg basicGetHttpSessionCfg()
  {
    return httpSessionCfg;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setHttpSessionCfg(HttpSessionCfg newHttpSessionCfg)
  {
    HttpSessionCfg oldHttpSessionCfg = httpSessionCfg;
    httpSessionCfg = newHttpSessionCfg;
        	
      SystemServiceMgr core=(SystemServiceMgr)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.SYSTEM_SERVICE_MANAGER__HTTP_SESSION_CFG, oldHttpSessionCfg, httpSessionCfg));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public HttpWebCfg getHttpWebConfig()
  {
    if (httpWebConfig != null && httpWebConfig.eIsProxy())
    {
      InternalEObject oldHttpWebConfig = (InternalEObject)httpWebConfig;
      httpWebConfig = (HttpWebCfg)eResolveProxy(oldHttpWebConfig);
      if (httpWebConfig != oldHttpWebConfig)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, ApusicPackage.SYSTEM_SERVICE_MANAGER__HTTP_WEB_CONFIG, oldHttpWebConfig, httpWebConfig));
      }
    }
        Object result=null;
        SystemServiceMgr core=(SystemServiceMgr)getCore();
        if(core==null) return httpWebConfig;	
        try
{
    result = core.fetchHttpWebConfig();
   HttpWebCfgImpl hci=new HttpWebCfgImpl();
     hci.setCore(result);
     result=hci;
     
}
catch(Exception e)
{
  result = null;
}
        httpWebConfig=(result instanceof EObject)?(HttpWebCfg)result:(HttpWebCfg)ImagePool.find(result);
        	
    return httpWebConfig; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public HttpWebCfg basicGetHttpWebConfig()
  {
    return httpWebConfig;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setHttpWebConfig(HttpWebCfg newHttpWebConfig)
  {
    HttpWebCfg oldHttpWebConfig = httpWebConfig;
    httpWebConfig = newHttpWebConfig;
        	
      SystemServiceMgr core=(SystemServiceMgr)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.SYSTEM_SERVICE_MANAGER__HTTP_WEB_CONFIG, oldHttpWebConfig, httpWebConfig));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__TRANS_CFG:
        if (resolve) return getTransCfg();
        return basicGetTransCfg();
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__MUXER_CFG:
        if (resolve) return getMuxerCfg();
        return basicGetMuxerCfg();
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__LOG_CFG:
        if (resolve) return getLogCfg();
        return basicGetLogCfg();
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__HTTP_SESSION_CFG:
        if (resolve) return getHttpSessionCfg();
        return basicGetHttpSessionCfg();
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__HTTP_WEB_CONFIG:
        if (resolve) return getHttpWebConfig();
        return basicGetHttpWebConfig();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__TRANS_CFG:
        setTransCfg((TransactionCfg)newValue);
        return;
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__MUXER_CFG:
        setMuxerCfg((MuxerCfg)newValue);
        return;
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__LOG_CFG:
        setLogCfg((LoggingCfg)newValue);
        return;
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__HTTP_SESSION_CFG:
        setHttpSessionCfg((HttpSessionCfg)newValue);
        return;
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__HTTP_WEB_CONFIG:
        setHttpWebConfig((HttpWebCfg)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__TRANS_CFG:
        setTransCfg((TransactionCfg)null);
        return;
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__MUXER_CFG:
        setMuxerCfg((MuxerCfg)null);
        return;
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__LOG_CFG:
        setLogCfg((LoggingCfg)null);
        return;
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__HTTP_SESSION_CFG:
        setHttpSessionCfg((HttpSessionCfg)null);
        return;
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__HTTP_WEB_CONFIG:
        setHttpWebConfig((HttpWebCfg)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__TRANS_CFG:
        return transCfg != null;
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__MUXER_CFG:
        return muxerCfg != null;
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__LOG_CFG:
        return logCfg != null;
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__HTTP_SESSION_CFG:
        return httpSessionCfg != null;
      case ApusicPackage.SYSTEM_SERVICE_MANAGER__HTTP_WEB_CONFIG:
        return httpWebConfig != null;
    }
    return super.eIsSet(featureID);
  }

} //SystemServiceManagerImpl
